[bsp/qemu-vexpress-a9] support function names in backtraces - #11728
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
|
作者可以把测试的日志截图发一下吗?触发backtrace指令后的截图样式 |
9250c7b to
d1cddbe
Compare
Pass -mpoke-function-name to the compiler and assembler when
RT_BACKTRACE_FUNCTION_NAME is enabled for the Cortex-A9 QEMU BSP.
Keep the BSP configuration opt-in so users can enable symbolized
backtraces through menuconfig without changing the default build.
The flag is appended through CCFLAGS and ASPPCOM after the build
environment is created instead of concatenating it into
CFLAGS/CXXFLAGS/ASFLAGS: when the toolchain is selected with
--exec-path, PrepareBuilding() reloads rtconfig and
_apply_exec_path_override() overwrites those variables, which would
silently drop the option. The build still succeeds but function names
are missing from the text section, leaving backtraces without usable
frames.
Example backtrace in QEMU (vexpress-a9, RT_BACKTRACE_FUNCTION_NAME=y,
fault triggered from msh through cmd_fault -> fault_level1 ->
fault_level2 -> fault_level3):
backtrace:
0x600475a8 @ fault_level3
0x600475dc @ fault_level2
0x60047608 @ fault_level1
0x60047630 @ cmd_fault
0x6006ca80 @ _msh_exec_cmd
0x6006cb3c @ msh_exec
0x600717b4 @ finsh_thread_entry
Signed-off-by: Hui Su <3164683437@qq.com>
d1cddbe to
cb2b39b
Compare
Pass -mpoke-function-name to the compiler and assembler when RT_BACKTRACE_FUNCTION_NAME is enabled for the Cortex-A9 QEMU BSP. Keep the BSP configuration opt-in so users can enable symbolized backtraces through menuconfig without changing the default build.
Validation:
为什么提交这份PR (why to submit this PR)
qemu-vexpress-a9 BSP 默认没有开启函数名符号支持,导致启用
RT_BACKTRACE_FUNCTION_NAME后 backtrace 仍然只能打印地址,无法直接显示函数名,调试体验较差。你的解决方案是什么 (what is your solution)
在
bsp/qemu-vexpress-a9/SConstruct中检测rtconfig.h是否定义了RT_BACKTRACE_FUNCTION_NAME,若已启用则向编译器和汇编器追加-mpoke-function-name选项。该选项由 GCC ARM 提供,会把函数名嵌入 text 段,使 Cortex-A 的 backtrace 能直接输出函数名。此配置保持 opt-in,不影响默认构建。请提供验证的bsp和config (provide the config and bsp)
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up